def shiftspec(x,shft):
	""" Time domain shift implemented by linear phase shift in spectrum domain."""
	xf=fft.rfft(x)
	l=xf.size
	ph=arange(0,l)*2*pi*float(shft)/l*1j
	if l/2==floor(l/2):
		ph[l/2]=0
		ph[l/2+1:l]=-p[l/2-1:0:-1]
	else:
		ph[ceil(l/2):l]=-p[floor(l/2):0:-1]
	y=fft.irfft(xf*exp(ph))
	return y
	
	
def profilechk(x,dot1,dot2):
	r=x.shape[0]
	c=x.shape[1]
	t=arange(0,r)
	if dot1[1]!=dot2[1]:
		a=(float(dot2[0])-dot1[0])/(dot2[1]-dot1[1])
		if a<=0:
			hmin=0
			hmax=min(c,ceil(dot1[1]-dot1[0]*a))
		else:
			hmax=c
			hmin=max(0,ceil(dot1[1]-dot1[0]*a))
		hrnge=arange(hmin,hmax)
		lc=a*(hrnge-dot1[1])+dot1[0]
		intpv=zeros(lc.shape)
		n=0
		for k in lc:
			s=max(0,floor(k)-3)
			e=min(r,floor(k)+4)
			intpv[n]=interp(k,t[s:e],x[s:e,hrnge[n]])
			n+=1
		plt.plot(hrnge,intpv)
		plt.show()
	else:
		print 'Two dots are at the same offset!'
						